import java.util.ArrayList;

public class Primes {

    public static final int MAXNUMBER = 1000;

    static ArrayList<Integer> findPrimeNumber() {
        ArrayList<Integer> primesNumbers = new ArrayList();
        for (int number = 1; number < MAXNUMBER; number++) {
            int dividerSummary = 0;
            for (int iterator = 1; iterator <= number; iterator++) {
                if (number % iterator == 0) {
                    dividerSummary++;
                }
            }
            if (dividerSummary == 2) {
                primesNumbers.add(number);
            }
        }
        return primesNumbers;
    }

    public static void main(String[] args) {
        System.out.println("Prime numbers 1 to 1000:");
        System.out.println(findPrimeNumber().toString());
    }
}


